<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>融资机构基础信息 新增</title>
<jsp:include page="../../import.jsp" flush="true" />

</head>
<body>
	<form id="friBaseInfo_form">
		<div class="fieldset1 tabel_col tabel_col_1 clearFix">
			<!-- <div class="fieldset1 tabel_col tabel_col_s clearFix noBorder"> -->
			<div class="fieldBox col_33">
				<div class="label">融资机构名称：</div>
				<div class="field">
					<input name="fundRasInsNm" id="fundRasInsNm" type="text" class="ui-textbox" value="" validate="{required:true, maxlength:100}">
					<span class="requiredSymbol">*</span>
				</div>
			</div>
			<div class="fieldBox col_33">
				<div class="label">机构缩写：</div>
				<div class="field">
					<input name="insAbb" id="insAbb" type="text" class="ui-textbox" value="" validate="{required:true,English:true, maxlength:20}">
					<span class="requiredSymbol">*</span>
				</div>
			</div>
			<div class="fieldBox col_33">
				<div class="label">融资机构类型：</div>
				<div class="field">
					<select name="insTypeCd" id="insTypeCd" data-value="" validate="{required:true}">
						<c:forEach items="${insTypeList }" var="kv">
							<option value="${kv.key }">${kv.value }</option>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="fieldBox col_33">
				<div class="label">是否为ABS：</div>
				<div class="field">
					<select name="isAbs" id="isAbs" data-value="" validate="{required:true}">
						<c:forEach items="${yesNoList }" var="kv">
							<option value="${kv.key }">${kv.value }</option>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="fieldBox col_33">
				<div class="label">机构用途：</div>
				<div class="field">
					<input type="text"  name="insUseCdNm" id="insUseCdNm"  class="ui-textbox" validate="{required:true}">
					<input type="hidden" name="insUseCd" id="insUseCd" data-ligerid="insUseCdNm" value="">
					<span class="requiredSymbol">*</span>
				</div>
			</div>
			<div class="fieldBox col_33" id="isOutPayDiv" style="display:none">
				<div class="label">是否外部机构投放：</div>
				<div class="field">
					<select name="isOutPay" id="isOutPay" data-value="" validate="{required:true}">
						<c:forEach items="${yesNoList }" var="kv">
							<option value="${kv.key }">${kv.value }</option>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="fieldBox col_33"   id="insRepayTypeNm"  style="display:none">
				<div class="label">还款方式：</div>
				<div class="field">
				   <select name="insRepayType" id="insRepayType" data-value="" >
						<c:forEach items="${insRepayTypeList }" var="kv">
							<option value="${kv.key }">${kv.value }</option>
						</c:forEach>
					</select>
					<span >*</span>
				</div>
			</div>
			<div class="fieldBox col_33"   id="topFinanceDiv"  style="display:none">
				<div class="label">单户累计融资额上限:</div> 
				<div class="field">
				   	<input name="topFinance" id="topFinance" type="text" class="ui-textbox" value="" validate="{maxlength:20,digits:true}">
					万<span class="requiredSymbol">*</span>		
				</div>
			</div>
			<div class="fieldBox col_100" id="fileModify">
				<div class="label">资料</div>
				<div class="field">
					<jsp:include page="../../system/sysUlFilesRec/sysUlFileRecList.jsp" flush="true">
						<jsp:param name="pkId" value="${id }" />
						<jsp:param name="tabNm" value="CST_BSC_INFO" />
					</jsp:include>
				</div>
			</div>
			<div class="fieldBox col_100">
				<div class="label">资料上传</div>
				<div class="field">
					<jsp:include page="../../system/sysUlFilesRec/sysSysUlFilesRecUpload2.jsp" flush="true">
						<jsp:param name="filePath" value="customer" />
					</jsp:include>
				</div>
			</div>
			<div class="fieldBox col_100" id="zgTextDiv" style="display:none">
				<div class="label">资管提示信息：</div>
				<div class="field">
					<textarea name="zgText" id="zgText" cols="80" rows="4" class="l-textarea" style="width:560px"></textarea>
					<span class="requiredSymbol">*</span>
				</div>
			</div>
			<div class="fieldBox col_100">
				<div class="label">备注：</div>
				<div class="field">
					<textarea name="rem" id="rem" cols="80" rows="4" class="l-textarea" style="width:560px"></textarea>
				</div>
			</div>
			<!-- hide data -->
			<div class="fieldBox col_100" style="display:none;">
				<div class="field">
					<input name="dataId" id="dataId" type="text" class="ui-textbox" value="${id}">
				</div>
			</div>
		</div>

		<table class="sq-formTable">
			<tbody>
				<tr>
					<td style="padding: 0;text-align: center;">
						<table id="tableBank" class="sq-formTable no-border">
							<thead>
								<tr>
									<th class="tbLabel" style="text-align: center;">帐户用途</th>
									<th class="tbLabel" style="text-align: center;">帐户类型</th>
									<th class="tbLabel" style="text-align: center;">开户行号</th>
									<th class="tbLabel" style="text-align: center;">开户行</th>
									<th class="tbLabel" style="text-align: center;">户名</th>
									<th class="tbLabel" style="text-align: center;">帐号</th>
									<th class="tbLabel" style="text-align: center;">帐号备注</th>
									<th class="tbLabel" style="text-align: center;">
										<span>操作 </span>
										<a href="javascript:void(0)" onclick="addRowBank(++a)">
											<font style="color:#6495ED;">（添加）</font>
										</a>
									</th>
								</tr>
							</thead>
							<tbody>

							</tbody>
						</table>
					</td>
				</tr>
			</tbody>
		</table>
		<br>
		<div class="field"id="ligergrid3"  style="display:none">
			资管机构限额信息
		</div>
		
		<table class="sq-formTable2" id="ligergrid2"  style="display:none">
			<tbody>
				<tr>
					<td style="padding: 0;text-align: center; width:1100px">
						<table id="tableBank2" class="sq-formTable no-border">
							<thead>
								<tr>
								    <th class="tbLabel" style="text-align: center;"></th>
									<th class="tbLabel" style="text-align: center;width:20%" >项目类型</th>
									<th class="tbLabel" style="text-align: center;width:20%">融资额上限（万）</th>
									<th class="tbLabel" style="text-align: center;width:18%">设备数上限（台）</th>
									<th class="tbLabel" style="text-align: center;width:15%">主车数量上限（台）</th>
									<th class="tbLabel" style="text-align: center;width:15%">挂车数量上限（台）</th>
									<th class="tbLabel" style="text-align: center;width:15%">是否支持纯挂</th>
									<th class="tbLabel" style="text-align: center;width:10%">
										<span>操作 </span>
										<a href="javascript:void(0)" onclick="addRowPrjTyp(++b)">
											<font style="color:#6495ED;">（添加）</font>
										</a>
									</th>
								</tr>
							</thead>
							<tbody>

							</tbody>
						</table>
					</td>
				</tr>
			</tbody>
		</table>
		<div class="btnsBox">
			<span id="cr_bsc_info_add_btn_id" class="sq-button sq-button-round" onclick="save();">保存 </span>
		</div>
	</form>
	<script type="text/javascript">
	
		var a=0;
		var b=0;
		$(function() {
		   $("#insUseCdNm").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true,
           	   data: [
	                {  name: 'key', width: 100}, 
	                {  name: 'value', width: 120},
	               ],
	            url:'<%=path%>/rfbase/fribaseinfo/getInsUseCd.do',
	            ajaxType :'GET',
	            slide: false,
	            valueField: 'key', textField: 'value',
	            valueFieldID: 'insUseCd',
	            onChangeValue: function (value) {
	            	if (this.findValueByText(value).indexOf("2") >=0) {
	            		$("#zgTextDiv").attr("style","");
	                	$("#ligergrid2").attr("style","");
	                	$("#ligergrid3").attr("style","");
	                	$("#insRepayTypeNm").attr("style","");
	                	$("#topFinanceDiv").attr("style","");
	                }else{
	                	$("#zgTextDiv").attr("style","display:none");
	                	$("#ligergrid2").attr("style","display:none");
	                	$("#ligergrid3").attr("style","display:none");
	                	$("#insRepayTypeNm").attr("style","display:none");
	                	$("#topFinanceDiv").attr("style","display:none");
	                }
	            	if (this.findValueByText(value).indexOf("3") >=0) {
	                	$("#isOutPayDiv").attr("style","");
	                }else{
	                	$("#isOutPayDiv").attr("style","display:none");
	                }
	            }

           });
		  
		   $("#friBaseInfo_form").ligerForm({
                validate: true
           });
	       initData();
	       initLimData();
		});
		
		//定义父级调用事件
		frameElement.dialog.onOk = function () {
			save();
		}
		
		frameElement.dialog.onCancel = function () {
			frameElement.dialog.close();
		}
		
		//保存
		function save(){
			var ligerForm = liger.get("friBaseInfo_form");
            if (!ligerForm.valid()) {
                UIUtils.alertWarning("有验证信息未通过!");
                return false; //验证不通过，不执行以下代码
            }
            var data = ligerForm.getData();
            var dataId = $("#dataId").val();
            var url = '<%=path%>/rfbase/fribaseinfo/add.do';
            if(StringUtils.isNotEmpty(dataId)){
            	url = '<%=path%>/rfbase/fribaseinfo/modify.do';
            	data["id"]= dataId;
            }
            // 机构用途
            var insUseCd = $("#insUseCd").val();
            if(insUseCd.indexOf("2") >=0){//资管时资管提示必填
            	if(data.zgText==''){
            		$.ligerDialog.alert("资管提示必填!");
                    return false; //验证不通过，不执行以下代码
            	}
            var ttt=data.zgText;
            	if((ttt).length>=500){
            		$.ligerDialog.alert("资管提示不能超过500字!");
                    return false; //验证不通过，不执行以下代码
            	}
            	if(data.topFinance==null || data.topFinance==''){
            		$.ligerDialog.alert("累计融资额上限必填!");
                    return false; //验证不通过，不执行以下代码
            	}
            }
            
        	data["insUseCd"]=insUseCd;
        	
            //赋值附件
            var docArray = JSON.stringify(getUploadResultParams());
            data["docArray"] = docArray;
            
            //银行帐户信息
			var bankArray = [];
            var accTypCdStr = "";
			var bankTr = $('#tableBank tbody tr');
			for (var i = 0; i < bankTr.length; i++) {
				var id = $.trim($(bankTr[i]).find("input[name='id']").val());
				var accTypCd = $.trim($(bankTr[i]).find(".accTypCd").val());
				accTypCdStr += (accTypCd+";");
				var pubVerPriCd = $.trim($(bankTr[i]).find("select[name='pubVerPriCd'] option:selected").val());
				var banAccNum = $.trim($(bankTr[i]).find("input[name='banAccNum']").val());
				var banAccNm = $.trim($(bankTr[i]).find("input[name='banAccNm']").val());
				var accNm = $.trim($(bankTr[i]).find("input[name='accNm']").val());
				var accNum = $.trim($(bankTr[i]).find("input[name='accNum']").val());
				var rem = $.trim($(bankTr[i]).find("input[name='rem']").val());
				if((pubVerPriCd == null || pubVerPriCd == '')&&(banAccNum == null || banAccNum == '')&& (banAccNm == null || banAccNm == '') && (accNm == null || accNm == '') && (accNum == null || accNum == '')){
					continue;
				}
				//banAccNum banAccNm accNm accNum 开户行号 开户行 户名 账户 不能为空
				if(banAccNum == '' || banAccNum == null){
					$.ligerDialog.alert("开户行号不能为空");
					return ;
				}
				if(banAccNm == '' || banAccNm == null){
					$.ligerDialog.alert("开户行不能为空");
					return ;
				}
				if(accNm == '' || accNm == null){
					$.ligerDialog.alert("户名不能为空");
					return ;
				}
				if(accNum == '' || accNum == null){
					$.ligerDialog.alert("账号不能为空");
					return ;
				}//end
				accNum = accNum.replace(/\s*/g,"");//账户去掉所有空格
				console.log(accNum);
				var bank = {
					"id" : id,
					"accTypCd" : accTypCd,
					"pubVerPriCd" : pubVerPriCd,
					"banAccNum" : banAccNum,
					"banAccNm" : banAccNm,
					"accNm" : accNm,
					"accNum" : accNum,
					"fundRasInsId" : dataId,
					"rem" : rem
				}
				bankArray.push(bank);
			}
			if(bankArray.length <1){
				$.ligerDialog.alert('至少填写一条银行数据！');
				return;
			}
			if(accTypCdStr.split('2').length>2){
				$.ligerDialog.alert('只能有一条帐户用途为“资管”的银行帐户！');
				return;
			}
			if(accTypCdStr.split('4').length>2){
				$.ligerDialog.alert('只能有一条帐户用途为“	再融资垫款账户”的银行帐户！');
				return;
			}
			data["bankArray"] = JSON.stringify(bankArray);
			
			//机构限额
			var typeArray = [];
			var tyes=[];
			var bankTr2 = $('#tableBank2 tbody tr');
			if(insUseCd.indexOf("2") >=0 && bankTr2.length<1){
				$.ligerDialog.alert("机构限额必须有一条数据");
				return ;
			}
				
			for (var i = 0; i < bankTr2.length; i++) {
				var id = $.trim($(bankTr2[i]).find("input[name='id']").val());
				var prjTypCd = $.trim($(bankTr2[i]).find("select[name='prjTypCd'] option:selected").val());
				var insLimAmt = $.trim($(bankTr2[i]).find("input[name='insLimAmt']").val());
				var insLimNum = $.trim($(bankTr2[i]).find("input[name='insLimNum']").val());
				var mainLimNum = $.trim($(bankTr2[i]).find("input[name='mainLimNum']").val());//主车数量上限	REQ-12550拆分资管机构二期
				var handLimNum = $.trim($(bankTr2[i]).find("input[name='handLimNum']").val());//挂车数量上限
				var isHang = $.trim($(bankTr2[i]).find("select[name='isHang'] option:selected").val());//是否支持纯挂
				insLimAmt = insLimAmt.replace(/\s*/g,"");//去掉所有空格
				insLimNum = insLimNum.replace(/\s*/g,"");//去掉所有空格
				mainLimNum = mainLimNum.replace(/\s*/g,"");
				handLimNum = handLimNum.replace(/\s*/g,"");
				if(1){
					if( insLimAmt == '' || insLimAmt == null || isNaN(insLimAmt) ){
						$.ligerDialog.alert("融资额上限必须是数字");
						return ;
					}
					var y = String(insLimAmt).indexOf(".") + 1;//获取小数点的位置
				    var count = String(insLimAmt).length - y;//获取小数点后的个数
				    if(y > 0 && count > 2) {
				    	$.ligerDialog.alert("融资额上限最多两位小数");
				    	return;
				    }
				    if(insLimAmt<0){
						   $.ligerDialog.alert("融资额上限必须>=0");
							return ;
					}
				}
				if(1){
					if(insLimNum == '' || insLimNum == null || isNaN(insLimAmt) ){
						$.ligerDialog.alert("设备数上限必须是数字");
						return ;
					}
					var y = String(insLimNum).indexOf(".") + 1;//获取小数点的位置
				    var count = String(insLimNum).length - y;//获取小数点后的个数
				    
				    if(y > 0) {
				    	$.ligerDialog.alert("设备数不能有小数");
				    	return ;
				    }
				   if(insLimNum<0){
					   $.ligerDialog.alert("设备数上限必须>=0");
						return ;
				   }
				}
				if(1){//mainLimNum
					if(mainLimNum == '' || mainLimNum == null || isNaN(mainLimNum) ){
						$.ligerDialog.alert("设备数上限必须是数字");
						return ;
					}
					var y = String(mainLimNum).indexOf(".") + 1;//获取小数点的位置
				    var count = String(mainLimNum).length - y;//获取小数点后的个数
				    
				    if(y > 0) {
				    	$.ligerDialog.alert("设备数不能有小数");
				    	return ;
				    }
				   if(mainLimNum<0){
					   $.ligerDialog.alert("设备数上限必须>=0");
						return ;
				   }
				}
				if(1){//handLimNum
					if(handLimNum == '' || handLimNum == null || isNaN(handLimNum) ){
						$.ligerDialog.alert("设备数上限必须是数字");
						return ;
					}
					var y = String(handLimNum).indexOf(".") + 1;//获取小数点的位置
				    var count = String(handLimNum).length - y;//获取小数点后的个数
				    
				    if(y > 0) {
				    	$.ligerDialog.alert("设备数不能有小数");
				    	return ;
				    }
				   if(handLimNum<0){
					   $.ligerDialog.alert("设备数上限必须>=0");
						return ;
				   }
				}
				for(var j = 0; j < tyes.length; j++){
					if(tyes[j]==prjTypCd){
						$.ligerDialog.alert("项目类型不能相同");
						return;
					}	
				}
				tyes.push(prjTypCd);
				var bank = {
					"id" : id,
					"prjTypCd" : prjTypCd,
					"insLimAmt" : insLimAmt,
					"insLimNum" : insLimNum,
					"mainLimNum":mainLimNum,
					"handLimNum":handLimNum,
					"isHang":isHang
				}
				typeArray.push(bank);
			}
			
			data["typeArray"] = JSON.stringify(typeArray);
			
			AjaxUtils.ajaxPost(url, data, addCallback);
		}

		//新增回调
		function addCallback(msg) {
			if (msg.success == 1) {
				UIUtils.alertSuccess(msg.info);
				/* 父级的弹出框关闭 */
				frameElement.dialog.close();
				
			} else {
				UIUtils.alertError(msg.info);
			}
		}
		
		
		//修改初始化数据
		function initData() {
			var dataId = $("#dataId").val();
			if (StringUtils.isEmpty(dataId)){
				addRowBank(a);// 初始化一行
				return;
			}
			var _url = '<%=path%>/rfbase/fribaseinfo/getById.do';
			AjaxUtils.ajaxGet(_url, {
				id : dataId
			}, initCallback);

		}

		//初始化回调
		function initCallback(msg) {
			if (msg.success == 1) {
				setData(msg.data);//设置数据
			} else {
				UIUtils.alertError(msg.info);
			}
		}

		//修改时候设置页面数据
		function setData(data) {
			var form = new liger.get("friBaseInfo_form");
			form.setData({
				fundRasInsNm : data.fundRasInsNm,
				insAbb : data.insAbb,
				insTypeCd : data.insTypeCd,
				attCd : data.attCd,
				rem : data.rem,
				isAbs :data.isAbs,
				zgText : data.zgText,
				insUseCdNm : data.insUseCd,
				insRepayType : data.insRepayType,
				topFinance:data.topFinance
			});
			if (data.insUseCd.indexOf("2") >=0) {
            	$("#zgTextDiv").attr("style","");
            }else{
            	$("#zgTextDiv").attr("style","display:none");
            }
			// 初始化一行
			addRowBank(a);
			var bankVos= data.bankAccInfoVOs;
			for (var i = 0; i < bankVos.length; i++) {
				var bankTr = $('#tableBank tbody tr:eq('+i+')');
				bankTr.find("input[name='id']").val(bankVos[i].id);
				$("#accTypCd-"+a).val(bankVos[i].accTypCd);
				bankTr.find("select[name='pubVerPriCd']").val(bankVos[i].pubVerPriCd);
				bankTr.find("input[name='banAccNum']").val(bankVos[i].banAccNum);
				bankTr.find("input[name='banAccNm']").val(bankVos[i].banAccNm);
				bankTr.find("input[name='accNm']").val(bankVos[i].accNm);
				bankTr.find("input[name='accNum']").val(bankVos[i].accNum);
				bankTr.find("input[name='rem']").val(bankVos[i].rem);
				if(i < bankVos.length-1){
					addRowBank(++a);
				}
			}
		};

		function addRowBank(a){
			$('#tableBank tbody').append('<tr>'+
				'<td style="text-align: center;">'+
					'<div class="field">'+
						'<input type="text"  name="accTypCdNm-'+a+'"  id="accTypCdNm-'+a+'"  class="ui-textbox" validate="{required:true}">'+
			             '<input type="hidden" class="accTypCd"  id="accTypCd-'+a+'" data-ligerid="accTypCdNm-'+a+'" value="">'+
					'</div>'+
				'</td>'+
				'<td style="text-align: center;">'+
					'<div class="field">'+
						'<select name="pubVerPriCd" style="width:120px;" data-value=" ">'+
							'<c:forEach items="${pubVerPriCdList }" var="kv">'+
								'<option value="${kv.key }">${kv.value }</option>'+
							'</c:forEach>'+
						'</select>'+
					'</div>'+
				'</td>'+
				'<td style="text-align: center;">'+
					'<div class="field">'+
						'<input name="banAccNum" type="text" class="ui-textbox" value="" >'+
					'</div>'+
				'</td>'+
				'<td style="text-align: center;">'+
					'<div class="field">'+
						'<input name="banAccNm" type="text" class="ui-textbox" value="" >'+
					'</div>'+
				'</td>'+
				'<td style="text-align: center;">'+
					'<div class="field">'+
						'<input name="accNm" type="text" class="ui-textbox" value="" >'+
					'</div>'+
				'</td>'+
				'<td style="text-align: center;">'+
					'<div class="field">'+
						'<input name="accNum" type="text" class="ui-textbox" value="" >'+
						'<input name="id" type="hidden" class="ui-textbox" value="" >'+
					'</div>'+
				'</td>'+
				'<td style="text-align: center;">'+
					'<div class="field">'+
						'<input name="rem" type="text" class="ui-textbox" value="" >'+
					'</div>'+
				'</td>'+
				'<td style="text-align: center;">'+
					'<a href="javascript:void(0)" onclick="delRow(this)">'+
						'<font style="color:#6495ED;">删除</font>'+
					'</a>'+
				'</td>'+
			'</tr>');
			 setAccTyp(a);
			 ++a;
		}
		
		function delRow(obj){
			if($("#tableBank").find("tr").length > 2){
				$(obj).parent().parent().remove();
			}
			else{
				$.ligerDialog.alert('不能删除，至少保留一条数据！');
			}
		}
		
		function  setAccTyp(id){
			 $("#accTypCdNm-"+id).ligerComboBox({ isShowCheckBox: true, isMultiSelect: true,
	     	   	 data: [ { name: 'key', width: 100}, 
	     	   	         { name: 'value', width: 120}
	     	   	 ],
		          url:'<%=path%>/rfbase/fribaseinfo/getAccTypCd.do',
		          ajaxType :'GET',
		          slide: false,
		          valueField: 'key', textField: 'value',
		          valueFieldID: 'accTypCd-'+id
		     }); 
		}
		function initLimData(){
			var dataId = $("#dataId").val();
			if (StringUtils.isEmpty(dataId)){
				
				return;
			}
			var _url = '<%=path%>/rfbase/fundRasInsLim/searchList.do';
			AjaxUtils.ajaxGet(_url, {
				insId : dataId
			}, initCallbackLim);
		}
		var types;
		function initCallbackLim(msg) {
			if (msg.success == 1) {
				//设置数据setData(msg.data);
				types=msg.types;
				// 初始化一行
				addRowBank2(b);
				var bankVos= msg.data;
				for (var i = 0; i < bankVos.length; i++) {
					var bankTr = $('#tableBank2 tbody tr:eq('+i+')');
					bankTr.find("input[name='id']").val(bankVos[i].id);
					bankTr.find("select[name='prjTypCd']").val(bankVos[i].prjTypCd);
					bankTr.find("input[name='insLimAmt']").val(bankVos[i].insLimAmt);
					bankTr.find("input[name='insLimNum']").val(bankVos[i].insLimNum);
					
					if(i < bankVos.length-1){
						addRowPrjTyp(++b);
					}
				}
				
			} else {
				UIUtils.alertError(msg.info);
			}
			
		}
		function addRowPrjTyp(b){
			$('#tableBank2 tbody').append('<tr>'+
				'<td style="text-align: center;">'+
					'<div class="field">'+
						b+
					'</div>'+
				'</td>'+
				'<td style="text-align: center;">'+
					
					'<div class="field">'+
						'<select name="prjTypCd" style="width:150px;" data-value=" ">'+
							'<c:forEach items="${prjTypCds }" var="kv">'+
								'<option value="${kv.key }">${kv.value }</option>'+
							'</c:forEach>'+
						'</select>'+
					'</div>'+
				'</td>'+
					'<input name="id" type="hidden" class="ui-textbox" value="" >'+
				'</td>'+
				
				'<td style="text-align: center;">'+
					'<div class="field">'+
						'<input name="insLimAmt" type="text" class="ui-textbox" value="" size=10>'+
						'<input name="checkbox1" type="checkbox" class="ui-textbox" value="" onclick="checknum1(this)">无'+
					'</div>'+
				'</td>'+
				'<td style="text-align: center;">'+
					'<div class="field">'+
						'<input name="insLimNum" type="text" class="ui-textbox" value="" size=10>'+
						'<input name="checkbox2" type="checkbox" class="ui-textbox" value="" onclick="checknum2(this)">无'+
					'</div>'+
				'</td>'+
				'<td style="text-align: center;">'+
					'<div class="field">'+
						'<input name="mainLimNum" type="text" class="ui-textbox" value="" size=10>'+
						'<input name="checkbox2" type="checkbox" class="ui-textbox" value="" onclick="checknum3(this)">无'+
					'</div>'+
				'</td>'+
				'<td style="text-align: center;">'+
					'<div class="field">'+
						'<input name="handLimNum" type="text" class="ui-textbox" value="" size=10>'+
						'<input name="checkbox2" type="checkbox" class="ui-textbox" value="" onclick="checknum4(this)">无'+
					'</div>'+
				'</td>'+
				'<td style="text-align: center;">'+
					'<div class="field">'+
						'<select name="isHang"  data-value=" ">'+
								'<option value="1">支持</option>'+
								'<option value="0">不支持</option>'+
						'</select>'+
					'</div>'+
				'</td>'+
				'<td style="text-align: center;">'+
					'<a href="javascript:void(0)" onclick="delRow2(this)">'+
						'<font style="color:#6495ED;">删除</font>'+
					'</a>'+
				'</td>'+
			'</tr>');
			 setAccTyp(b);
			 ++b;
		}
		
		function delRow2(obj){
			
				$(obj).parent().parent().remove();
			
			
		}
		function checknum1(obj){		
			
			if(obj.checked==true){
				$(obj).parent().find("input[name='insLimAmt']").attr("disabled","disabled");
				$(obj).parent().find("input[name='insLimAmt']").val(0);
			}else{
				$(obj).parent().find("input[name='insLimAmt']").removeAttr("disabled");
			}
		}
		function checknum2(obj){			
			if(obj.checked==true){
				$(obj).parent().find("input[name='insLimNum']").attr("disabled","disabled");
				$(obj).parent().find("input[name='insLimNum']").val(0);
			}else{
				$(obj).parent().find("input[name='insLimNum']").removeAttr("disabled");
			}
			
		}
		function checknum3(obj){			
			if(obj.checked==true){
				$(obj).parent().find("input[name='mainLimNum']").attr("disabled","disabled");
				$(obj).parent().find("input[name='mainLimNum']").val(0);
			}else{
				$(obj).parent().find("input[name='mainLimNum']").removeAttr("disabled");
			}
		}
		function checknum4(obj){			
			if(obj.checked==true){
				$(obj).parent().find("input[name='handLimNum']").attr("disabled","disabled");
				$(obj).parent().find("input[name='handLimNum']").val(0);
			}else{
				$(obj).parent().find("input[name='handLimNum']").removeAttr("disabled");
			}
		}
	</script>
	<script type="text/javascript">
	$(document).ready(function() {
		//英文
		$.validator.addMethod("English", function(value, element) {
	        return this.optional(element) || /^[a-zA-Z]+$/.test(value);
	    }, "该字段只能为英文");
	});
	</script>
</body>
</html>
